#include "stdafx.h"


class CGraph {

public:
	enum Type {

		Matrix = 0,
		Lists = 1
	};

public:
	CGraph( int _cV, int _cE, Type _type );
	~CGraph();

	int GetCountV();
	int GetCountE();
	int GetWeight( int vSrc, int vDst );
	std::vector< int > GetNeighbours( int v );
	bool AddEdge( int vSrc, int vDst, int weight );
	bool AddNegEdge( int vSrc, int vDst, int weight );
	bool HaveNegCycle();
	bool IsConnected();

	// Algorytmy
	int * Dijkstra( int u );
	int * BellmanFord( int u );

private:
	void DFS( bool * connected, std::vector< int > neighbours );

private:
	int cV;
	int cE;
	int type;

	int ** gMatrix;
	std::vector< std::vector< int > > gLists;
};